<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVoteCandidatesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('vote_candidates', function (Blueprint $table) {
            $table->uuid('id')->unique();
            $table->uuid('group_id')->nullable();
            $table->uuid('activity_id');
            $table->integer('order_id');
            $table->string('title');
            $table->integer('type'); //1、图片 2、音频 3、视频 4、外链
            $table->string('cover_url');
            $table->string('resource_url')->nullable();
            $table->string('content')->nullable();
            $table->string('description')->nullable();
            $table->integer('votes_number')->default(0);

            $table->timestamps();
            $table->softDeletes();

            $table->index('group_id');
            $table->index('activity_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('vote_candidates');
    }
}
